﻿using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Poke_Tactics.Cenas.Story
{
    class Intro_1
   {
        GameWindow Window;
        Texture2D image;
        Button next;

        protected float alfa;

        public float Alfa 
        {
            get {return alfa;}

            set 
            {

                if(value>=0 && value <= 1)
                {
                    alfa = value;
                }
                else
                {
                    alfa = 1;
                }

            }
        
        }


        float scale = 1.177f;

        public Intro_1(GameWindow Window, Texture2D image, Texture2D button)
        {
            this.Window = Window;
            this.image = image;
            this.next = new Button(Window, button);
            next.position = new Vector2(690, 410);
        }

        public void Update(GameTime gameTime, MouseState mouse, MouseState old_mouse)
        {

            next.Update(gameTime, new Vector2(mouse.X, mouse.Y), mouse, old_mouse);

            if(gameTime.TotalGameTime.Milliseconds % 100 == 0)
            {
                Alfa += 0.02f;
            }

            if (next.isClicked || Alfa >= 1.0f)
            {
                Game1.cena_atual = Game1.cenas.CENA_INTRO_2;
                next.isClicked = false;
            }
        }


        public void Draw(GameTime gameTime, SpriteBatch spriteBatch)
        {

           // spriteBatch.Draw(image, new Rectangle(0, 0, image.Width, image.Height), Color.White);

            spriteBatch.Draw(image, new Vector2(0, 0), new Rectangle(0, 0, (int)(image.Width * 1), (int)(image.Height * 1)), new Color(1.0f * alfa, 1.0f * alfa, 1.0f * alfa, 1.0f * alfa), 0, new Vector2(), scale, SpriteEffects.None, 0); 

            next.Draw(gameTime, spriteBatch);


        }


   }
}
